/**
 * \file ClassHeap.h
 * \brief Allows you to handle a bulk of classes all owned by a single package
 *
 * The ClassHeap stores all the information about the classes stored in the package.
 * To implement it, we stores some information in a file: in that file, the data is indexed
 * with various hashtable;
 * 
 * \dot
 * 	digraph {
 * 		subgraph cluster {
 * 			label="hashtable cell";
 * 			A [label="Data to get\nconverted in\nInteger" shape="rect"];
 * 			B [label="Relative pointer\nto actual data position\nin the heap" shape="rect"];
 * 			A->B;
 * 		}
 * 	}
 * \endot
 *
 * All the hashtables, however, associate some valuable data starting from
 * a integer which identify the data to get. The way to retrieve the integer may
 * vary from structure to structure; for example:
 * \li for a Label the integer is computed by converting only the actual string;
 * \li for a Schema
 *
 * 
 * \date Nov 18, 2013
 * \author koldar
 */

#ifndef CLASSHEAP_H_
#define CLASSHEAP_H_

#include <stdio.h>

typedef struct ClassHeap {
	/**the pointer to the labelHashtable
	 *
	 */
	void* labelHashtable;
	/**the length of the label hashtable
	 *
	 */
	unsigned int labelHashtableSize;
	/**the value used to compute the second hash
	 *
	 */
	unsigned int n2labelHashtable;
	void* classHashtable;
	unsigned int classHashtableSize;
	void* nameHashtable;
	unsigned int nameHashtableSize;
	void* idListHashtable;
	unsigned int idListHashtableSize;
	void* heap;
	unsigned int heapSize;

} ClassHeap;

/**pointer to a ClassHeap
 *
 */
typedef ClassHeap* PclassHeap;


PclassHeap loadClassHeap(FILE* f);

//TODO documentation
void saveClassHeap(FILE* f, PclassHeap heap);

#endif /* CLASSHEAP_H_ */
